#!/bin/sh
# Job yaml can send below ENVIRONMENT VARIABLES to me
# - runtime
# END ENVIRONMENT VARIABLES

## qperf measures bandwidth and latency between two nodes.
## It can work over TCP/IP as well as the RDMA transports.

. $LKP_SRC/lib/reproduce-log.sh

cmd=''
if type qperf >/dev/null 2>&1;then
  cmd='qperf'
elif [ -e "$BENCHMARK_ROOT/qperf" ];then
  cmd='./qperf'
  cd $BENCHMARK_ROOT/qperf
else
   die "no qperf"
fi

modprobe sctp 2>/dev/null

nr_tests=6
tests="
tcp_bw
tcp_lat
udp_bw
udp_lat
sctp_bw
sctp_lat
"
# rds_bw
# rds_lat

[ -n "$runtime" ] || runtime=600
time=$((runtime / nr_tests))

[ -n "$direct_server_ips" ] && server=$direct_server_ips
[ -z "$server" ] && server=127.0.0.1
server=${server%% *}

log_cmd $cmd $server --unify_units --time $time $tests quit
